package routers

import (
	"gin_gorm/web/controllers"
	"github.com/gin-gonic/gin"
	"github.com/google/wire"
)

type RouterInterface interface {
	SetupRoutes(engine *gin.Engine)
}

func setupRouters(engine *gin.Engine, routers []RouterInterface) {
	for _, router := range routers {
		router.SetupRoutes(engine)
	}
}
func NewRouterList(
	user *controllers.UserController, admin *controllers.AdminController,
) []RouterInterface {
	return []RouterInterface{
		user, admin,
	}
}
func NewRouter(routers []RouterInterface) *gin.Engine {
	engine := gin.Default()
	setupRouters(engine, routers)
	return engine
}

var ProviderSet = wire.NewSet(
	NewRouterList,
	NewRouter,
)
